<link href="<?php echo base_url('theme/css/frontend/company-add.css'); ?>" rel="stylesheet">
<link rel="stylesheet" href="<?php echo base_url('theme/css/frontend/jquery.Jcrop.min.css'); ?>" type="text/css" />
<script type="text/javascript">
     $(document).ready(function() {
        typePopup(); 
     });
</script>
<div class="wrapper company-add">

  <?php echo validation_errors('<div class="alert alert-error">','</div>'); ?>
  <h3>Đăng ký thông tin  doanh nghiệp</h3>
  <hr class=hr />
  
  <form method="post" id=form-info class="form-horizontal" action=<?php echo base_url('company/add'); ?> enctype=multipart/form-data >
    <h5>Thông tin doanh nghiệp</h5>
    <hr class="hr hr2" />
    
    <div class=info>
      <div class="control-group">
        <label for="name" class="control-label">Tên công ty<i>*</i></label>
        <div class="controls">
          <input type=text name=name id=name class="input-xxlarge" value="<?php echo set_value('name', $company['name']); ?>">
       	</div>
      </div>
      <div class="control-group">
       	<label for="abbreviation" class="control-label">Tên viết tắt</label>
       	<div class="controls">
       	  <input type=text name=abbreviation id=abbreviation class="input-xxlarge" value="<?php echo set_value('abbreviation', $company['abbreviation']); ?>">
       	</div>
      </div>
      <div class="control-group">
        <label for="english_name" class="control-label">Tên tiếng anh</label>
       	<div class="controls">
       	  <input type=text name=english_name id=english_name class="input-xxlarge" value="<?php echo set_value('english_name', $company['english_name']); ?>">
       	</div>
      </div>
      <div class="control-group">
        <label for="address" class="control-label">Địa chỉ<i>*</i></label>
       	<div class="controls">
       	  <input type=text name=address id=address class="input-xxlarge" value="<?php echo set_value('address', $company['address']); ?>">
       	</div>
      </div>
      <div class="control-group">
        <label for="tax_code" class="control-label">Mã số thuế</label>
       	<div class="controls">
       	  <input type=text name=tax_code id=tax_code class="input-xxlarge" value="<?php echo set_value('tax_code', $company['tax_code']); ?>">
       	</div>
      </div>
      <div class="control-group">
        <label for="tel" class="control-label">Điện thoại/ fax</label>
       	<div class="controls">
       	  <input type=text name=tel id=tel class="input-xxlarge" value="<?php echo set_value('tel', $company['tel']); ?>" >
       	</div>
      </div>
      <div class="control-group">
        <label for="website" class="control-label">Website</label>
       	<div class="controls">
       	  <input type=text name=website id=website class="input-xxlarge" value="<?php echo set_value('website', $company['website']); ?>">
       	</div>
      </div>
      <div class="control-group">
        <label for="email" class="control-label">Email<i>*</i></label>
       	<div class="controls">
       	  <input type=text name=email id=email class="input-xxlarge" value="<?php echo set_value('email', $company['email']); ?>">
       	</div>
      </div>
      <div class="control-group">
       	<label for="representative" class="control-label">Người đại diện</label>
       	<div class="controls">
       	  <input type=text name=representative id=representative class="input-xxlarge" value="<?php echo set_value('representative', $company['representative']); ?>">
       	</div>
      </div>
      <div class="control-group">
        <label for="cellphone" class="control-label">Di động</label>
       	<div class="controls">
       	  <input type=text name=cellphone id=cellphone class="input-xxlarge" value="<?php echo set_value('cellphone', $company['cellphone']); ?>">
       	</div>
      </div>
      <div class="control-group">
        <label for="charter_capital" class="control-label">Vốn điều lệ</label>
       	<div class="controls">
       	  <input type=text name=charter_capital id=charter_capital class="input-xxlarge" value="<?php echo set_value('charter_capital', $company['charter_capital']); ?>">
       	</div>
      </div>
      <div class="control-group">
       	<label for="business_types" class="control-label">Loại hình doanh nghiệp<i>*</i></label>
       	<div class="controls">
        	<select name=business_types id=business_types>  
        	  <option value=0  <?php echo set_select('business_types', '100', $company['business_types']==100?TRUE:FALSE); ?>> -- </option>  
      		  <option value=0  <?php echo set_select('business_types', '0', $company['business_types']==0?TRUE:FALSE); ?>>Doanh nghiệp nước ngoài</option>
              <option value=1  <?php echo set_select('business_types', '1', $company['business_types']==1?TRUE:FALSE); ?>>Khác</option>
              <option value=2  <?php echo set_select('business_types', '2', $company['business_types']==2?TRUE:FALSE); ?>>Tập đoàn - tổng công ty</option>
              <option value=3  <?php echo set_select('business_types', '3', $company['business_types']==3?TRUE:FALSE); ?>>Văn Phòng Đại Diện</option>
      		  <option value=4  <?php echo set_select('business_types', '4', $company['business_types']==4?TRUE:FALSE); ?>>Văn Phòng Chi Nhánh</option>
              <option value=5  <?php echo set_select('business_types', '5', $company['business_types']==5?TRUE:FALSE); ?>>TNHH Một Thành Viên</option>
              <option value=6  <?php echo set_select('business_types', '6', $company['business_types']==6?TRUE:FALSE); ?>>TNHH</option>
              <option value=7  <?php echo set_select('business_types', '7', $company['business_types']==7?TRUE:FALSE); ?>>Liên Doanh</option>
              <option value=8  <?php echo set_select('business_types', '8', $company['business_types']==8?TRUE:FALSE); ?>>Hợp Danh</option>
              <option value=9  <?php echo set_select('business_types', '9', $company['business_types']==9?TRUE:FALSE); ?>>Doanh Nghiệp Tư Nhân</option>
              <option value=10 <?php echo set_select('business_types', '10', $company['business_types']==10?TRUE:FALSE); ?>>Doanh Nghiệp Nhà Nước liên doanh với nước ngoài</option>
              <option value=11 <?php echo set_select('business_types', '11', $company['business_types']==11?TRUE:FALSE); ?>>Doanh Nghiệp Nhà Nước</option>
              <option value=12 <?php echo set_select('business_types', '12', $company['business_types']==12?TRUE:FALSE); ?>>Doanh Nghiệp Một Thành Viên</option>
              <option value=13 <?php echo set_select('business_types', '13', $company['business_types']==13?TRUE:FALSE); ?>>Doanh Nghiệp liên doanh với nước ngoài</option>
              <option value=14 <?php echo set_select('business_types', '14', $company['business_types']==14?TRUE:FALSE); ?>>Doanh Nghiệp 100% vốn đầu tư nước ngoài</option>
              <option value=15 <?php echo set_select('business_types', '15', $company['business_types']==15?TRUE:FALSE); ?>>Doanh Nghiệp 100% vốn nhà nước hoạt động theo Luật DNNN</option>
              <option value=16 <?php echo set_select('business_types', '16', $company['business_types']==16?TRUE:FALSE); ?>>Chi nhánh Doanh Nghiệp nước ngoài đặt tại Việt Nam</option>
              <option value=17 <?php echo set_select('business_types', '17', $company['business_types']==17?TRUE:FALSE); ?>>Cổ phần</option>
              <option value=18 <?php echo set_select('business_types', '18', $company['business_types']==18?TRUE:FALSE); ?>>Công ty trách nhiệm hữu hạn NN 2 thành viên trở lên</option>        
              <option value=19 <?php echo set_select('business_types', '19', $company['business_types']==19?TRUE:FALSE); ?>>Công ty trách nhiệm hữu hạn NN 1 thành viên</option>        
              <option value=20 <?php echo set_select('business_types', '20', $company['business_types']==20?TRUE:FALSE); ?>>Công ty trách nhiệm hữu hạn NN 2 thành viên trở lên ngoài NN</option>        
              <option value=21 <?php echo set_select('business_types', '21', $company['business_types']==21?TRUE:FALSE); ?>>Công ty trách nhiệm hữu hạn NN 1 thành viên ngoài NN</option>        
              <option value=22 <?php echo set_select('business_types', '22', $company['business_types']==22?TRUE:FALSE); ?>>Công ty cổ phần NN</option>        
              <option value=23 <?php echo set_select('business_types', '23', $company['business_types']==23?TRUE:FALSE); ?>>Công ty cổ phần ngoài NN</option>        
              <option value=24 <?php echo set_select('business_types', '24', $company['business_types']==24?TRUE:FALSE); ?>>Cá Thể</option>        
              <option value=25 <?php echo set_select('business_types', '25', $company['business_types']==25?TRUE:FALSE); ?>>100% Vốn Nước Ngoài</option>
            </select>		             	
      	</div>
      </div>
      <div class="control-group">
       	<label for="businesses" class="control-label">Lĩnh vực kinh doanh<i>*</i></label>
       	<div class="controls">
       	  <a href="<?php echo base_url('category/index?ajax=true'); ?>" rel=categoryPopup[ajax]>
            <input type=text id=businesses_select class="input-xxlarge" value="<?php echo set_value('businesses', getCompanyBusiness($company['businesses'])); ?>">	
            <input type=hidden name=businesses id=businesses value="<?php echo set_value('businesses', $company['businesses']); ?>">             	
          </a>
          <div id=businesses_child></div>
          <script type="text/javascript">
          $(document).ready(function(){              
            // Category popup
            $("a[rel^='categoryPopup']").prettyPhoto({
              ajaxcallback: function() {
  	            // category popup
  	            $(".category-list ul li a, .category-list h4 a").click(function(){
  	  	          var businesses = $(this).data('category'); 
  	              $('#businesses_select').val($(this).text()); 
  	              $('#businesses').val(businesses);

				  // children
				  var child = $(this).text().split(', ');
				  if(child.length > 1) {	
            	    var s = $('<select />');
            	    $('<option />', {value: '--', text: '--'}).appendTo(s);
            	    for(var i = 0; i < child.length; i++) {
                	  var val = '99' + businesses + i
              	      $('<option />', {value: val, text: child[i]}).appendTo(s);
            	    }
            	    $('#businesses_child').html(s);

            	    $('#businesses_child select').change(function() {
                	  if($(this).val() != '--') {
            	    	$('#businesses').val($(this).val());
                	  } else {
                		$('#businesses').val(businesses);  
                      }
            	    });
				  } // end child
  	              
  	              $.prettyPhoto.close();
  	          	  return false;
  	            }); 
              },
              markup: '<div class="pp_container" role="dialog"><div class="pp_loaderIcon"></div><div class="pp_placeholder"></div></div><div class="pp_overlay"></div>'
            });
          });
          </script>
        </div>
      </div>
      <div class="control-group">
        <label for="business_license_issued_on" class="control-label">Giấy phép cấp ngày</label>
       	<div class="controls">
       	  <input type=text name=business_license_issued_on id=business_license_issued_on class="input-xxlarge" value="<?php echo set_value('business_license_issued_on', $company['business_license_issued_on']); ?>">
       	</div>
      </div>
      <div class="control-group">
        <label for="other_businesses" class="control-label">Ngành nghề kinh doanh khác</label>
       	<div class="controls">
       	  <input type=text name=other_businesses id=other_businesses class="input-xxlarge" value="<?php echo set_value('other_businesses', $company['other_businesses']); ?>">
        </div>
      </div>
      <div class="control-group">
       	<label for="posting_area" class="control-label">Khu vực đăng tin<i>*</i></label>
       	<div class="controls">
       	  <a href="<?php echo base_url('city/index?ajax=true'); ?>" rel=postAreaPopup[ajax]>
            <input type=text id=posting_area_select class="input-xxlarge" value="<?php echo set_value('posting_area', getCity($company['posting_area'])); ?>">	
            <input type=hidden name=posting_area id=posting_area value="<?php echo set_value('posting_area', $company['posting_area']); ?>">             	
          </a>
          <script type="text/javascript">
          $(document).ready(function(){
            // City popup
            $("a[rel^='postAreaPopup']").prettyPhoto({
              type: 'city',
              ajaxcallback: function() {
            	// city popup
  	            $(".city-list ul li a, .city-list h4 a").click(function(){ 
  	              $('#posting_area_select').val($(this).text()); 
  	              $('#posting_area').val($(this).data('city'));
  	              $.prettyPhoto.close();
  	          	  return false;
  	            }); 
              },
              markup: '<div class="pp_container" role="dialog"><div class="pp_loaderIcon"></div><div class="pp_placeholder"></div></div><div class="pp_overlay"></div>',
              height: 340,
              width: 880
            });
          });
          </script>
        </div>
      </div>
      <div class="control-group">
        <label for="company_background" class="control-label">Giới thiệu doanh nghiệp<i>*</i></label>
       	<div class="controls">
          <textarea name="company_background" id="company_background"><?php echo set_value('company_background', $company['company_background']); ?></textarea>
          <!-- editor -->
          <script src="<?php echo base_url('theme/third_party/epicEditor/scripts/epiceditor.js'); ?>" type="text/javascript"></script>
          <script type="text/javascript">
          //<![CDATA[    
          epicEditor.init({
          	containId: 'company_background',
          	buttons1 : 'bold,italic,underline,strikethrough,fontsize,fontname,justifyleft,justifycenter,justifyright,justifyfull,removeformat,inserthtml',
          	width:502,
          	height:200
          });
          //]]>
          </script>
          <!-- /editor -->
        </div>
      </div>
      <div class="control-group">
        <label for="intro_video" class="control-label">Video Youtube</label>
       	<div class="controls">
       	  <input type=text name=intro_video id=intro_video class="input-xxlarge" value="<?php echo set_value('intro_video', $company['intro_video']); ?>">
        </div>
      </div>
      <div class="control-group">
        <label for="intro_video" class="control-label">Channel Youtube</label>
       	<div class="controls">
       	  <input type=text name=video id=video class="input-xxlarge" value="<?php echo set_value('video', $company['video']); ?>">
        </div>
      </div>
      <div class="control-group">
        <div class=controls>
          <input type=hidden name=company_id id=company_id value="<?php echo $company['company_id'] ?>"/>
          <button class="btn" type=submit name=info value="Lưu thay đổi">Lưu thay đổi</button>
          <button class="btn" type="button">Hủy bỏ</button>
        </div>
      </div>
    </div>
  </form>
  
  <?php $types = array('logo' => 'Logo', 
  					   'avatar' => 'Ảnh đại diện'); ?>
  <?php foreach ($types as $type => $name): ?>
  <div style="border-left: 1px solid #C6C6C6; border-right: 1px solid #C6C6C6; padding: 15px 30px;">
    <h5><?php echo $name ?></h5>
    <hr class="hr hr2" />
    <div class="<?php echo $type ?>">
      <form method="post" id="upload_<?php echo $type ?>" class="form-horizontal" action=<?php echo base_url('company/uploadFile/' . $type); ?> enctype=multipart/form-data > 
        <div class=control-group>
          <label for="<?php echo $type ?>" class="control-label">Chọn ảnh<i>*</i></label>
         	<div class="controls">
         	  <input type="hidden" id="MAX_FILE_SIZE" name="MAX_FILE_SIZE" value="600000" />
         	  <input type="file" id="file_<?php echo $type ?>" name="file_<?php echo $type ?>[]" multiple="multiple" />
         	</div>
        </div>
        <div class="submitbutton">
          <button type="submit">Upload Files</button>
        </div>
      </form>
      <ul class="thumbnails">
      <?php
        // made dir
        $dir = 'upload/company/' . $type . '/' . $_SESSION['userLoggedIn']['id'];
        if (!file_exists($dir)) {
            @mkdir($dir, 0777, true);
        }
        // Open the folder
        $dir_handle = opendir($dir);    
        // Loop through the files
        while ($file = readdir($dir_handle)) {
          if($file == "." || $file == ".." || $file == "index.php" )
            continue;
          echo '<li style="height:60px; padding-left: 5px;"><img width="90" src="' . base_url('upload/company/' . $type . '/' . $_SESSION['userLoggedIn']['id'] . '/' . $file) .'" /></li>';
        }
        // Close
        closedir($dir_handle);
      ?>
      </ul>
      <div id="<?php echo $type; ?>_append"></div>
      <form class="form-horizontal" action="<?php echo base_url('company/addFile/' . $type); ?>" method="post">
        <div class="control-group">
          <div class=controls>
            <input type=hidden name=company_id id=company_id value="<?php echo $company['company_id'] ?>"/>
            <input type="hidden" id="data<?php echo $type ?>CropJson" name="data<?php echo $type ?>CropJson" />
            <button class="btn" type=submit value="Lưu thay đổi">Lưu thay đổi</button>
            <button class="btn" type="button">Hủy bỏ</button>
          </div>
        </div>
      </form>
    </div>
  </div>
  <?php endforeach; ?>
  
  <div style="border-left: 1px solid #C6C6C6; border-right: 1px solid #C6C6C6; padding: 15px 30px;">
    <h5>Ảnh giới thiệu</h5>
    <hr class="hr hr2" />
    <div class=intro_images>
      <form method="post" id="upload_intro_images" class="form-horizontal" action=<?php echo base_url('company/uploadFile/intro_images'); ?> enctype=multipart/form-data > 
        <div class=control-group>
          <label for="email" class="control-label">Chọn ảnh<i>*</i></label>
         	<div class="controls">
         	  <input type="hidden" id="MAX_FILE_SIZE" name="MAX_FILE_SIZE" value="600000" />
         	  <input type="file" id="file_intro_images" name="file_intro_images[]" multiple="multiple" />
         	</div>
        </div>
        <div class="submitbutton">
          <button type="submit">Upload Files</button>
        </div>
      </form>
      <ul class="thumbnails">
      <?php
        // made dir
        $introImagesDir = 'upload/company/intro_images/' . $_SESSION['userLoggedIn']['id'];
        if (!file_exists($introImagesDir)) {
            @mkdir($introImagesDir, 0777, true);
        }
        // Open the folder
        $dir_handle = opendir($introImagesDir);    
        // Loop through the files
        while ($file = readdir($dir_handle)) {
          if($file == "." || $file == ".." || $file == "index.php" )
            continue;
          echo '<li style="height:60px; padding-left: 5px;"><img width="90" src="' . base_url('upload/company/intro_images/' . $_SESSION['userLoggedIn']['id'] . '/' . $file) .'" /></li>';
        }
        // Close
        closedir($dir_handle);
      ?>
      </ul>
      <div id="intro_images_append"></div>
      <form class="form-horizontal" action="<?php echo base_url('company/addFile/intro_images'); ?>" method="post">
        <div class="control-group">
          <div class=controls>
            <input type=hidden name=company_id id=company_id value="<?php echo $company['company_id'] ?>"/>
            <input type="hidden" id="dataIntroImagesCropJson" name="dataIntroImagesCropJson" />
            <button class="btn" type=submit value="Lưu thay đổi">Lưu thay đổi</button>
            <button class="btn" type="button">Hủy bỏ</button>
          </div>
        </div>
      </form>
    </div>
  </div>
  
  <div style="border-left: 1px solid #C6C6C6; border-right: 1px solid #C6C6C6; padding: 15px 30px;">
    <h5>Album doanh nghiệp</h5>
    <hr class="hr hr2" />
    <div class=album>
      <form method="post" id="upload_album" class="form-horizontal" action=<?php echo base_url('company/uploadFile/album'); ?> enctype=multipart/form-data > 
        <div class=control-group>
          <label for="email" class="control-label">Chọn ảnh<i>*</i></label>
         	<div class="controls">
         	  <input type="hidden" id="MAX_FILE_SIZE" name="MAX_FILE_SIZE" value="600000" />
         	  <input type="file" id="file_album" name="file_album[]" multiple="multiple" />
         	</div>
        </div>
        <div class="submitbutton">
          <button type="submit">Upload Files</button>
        </div>
      </form>
      <ul class="thumbnails">
      <?php
        // made dir
        $albumDir = 'upload/company/album/' . $_SESSION['userLoggedIn']['id'];
        if (!file_exists($albumDir)) {
            @mkdir($albumDir, 0777, true);
        }
        // Open the folder
        $dir_handle = @opendir($albumDir) or die("Unable to open $albumDir");    
        // Loop through the files
        while ($file = readdir($dir_handle)) {
          if($file == "." || $file == ".." || $file == "index.php" )
            continue;
          echo '<li style="height:60px; padding-left: 5px;"><img width="90" src="' . base_url('upload/company/album/' . $_SESSION['userLoggedIn']['id'] . '/' . $file) .'" /></li>';
        }
        // Close
        closedir($dir_handle);
      ?>
      </ul>
      <div id="album_append"></div>
      <form class="form-horizontal" action="<?php echo base_url('company/addFile/album'); ?>" method="post">
        <div class="control-group">
          <div class=controls>
            <input type=hidden name=company_id id=company_id value="<?php echo $company['company_id'] ?>"/>
            <input type="hidden" id="dataAlbumCropJson" name="dataAlbumCropJson" />
            <button class="btn" type=submit value="Lưu thay đổi">Lưu thay đổi</button>
            <button class="btn" type="button">Hủy bỏ</button>
          </div>
        </div>
      </form>
      <script src="<?php echo base_url('theme/js/frontend/jquery.Jcrop.min.js'); ?>"></script>
      <script src="<?php echo base_url('theme/js/frontend/jquery.json-2.4.min.js'); ?>"></script>
      <script src="<?php echo base_url('theme/js/frontend/filedrag.js'); ?>"></script>
    </div>
  </div>
  
  <form method="post" id="form-recruit" class="form-horizontal" action=<?php echo base_url('company/add'); ?>>   
    <h5>Doanh nghiệp đăng tin tuyển dụng</h5>
    <hr class="hr hr2" />
    
    <div class=recruit>
      <div class="control-group">
        <label for="date" class="control-label">Ngày đăng tuyển dụng<i>*</i></label>
        <div class="controls">
          <input type=text name=date id=date class="input-xxlarge" value="<?php echo set_value('date', $company['date']); ?>">
       	</div>
      </div>
      <div class="control-group">
        <label for="quantity" class="control-label">Số lượng cần tuyển<i>*</i></label>
        <div class="controls">
          <input type=text name=quantity id=quantity class="input-xxlarge" value="<?php echo set_value('quantity', $company['quantity']); ?>">
        </div>
      </div>
      <div class="control-group">
        <label for="property" class="control-label">Tính chất<i>*</i></label>
        <div class="controls">
          <input type=text name=property id=property class="input-xxlarge" value="<?php echo set_value('property', $company['property']); ?>">
        </div>
      </div>
      <div class="control-group">
        <label for="work_place" class="control-label">Địa điểm làm việc<i>*</i></label>
        <div class="controls">
          <input type=text name=work_place id=work_place class="input-xxlarge" value="<?php echo set_value('work_place', $company['work_place']); ?>">
        </div>
      </div>
      <div class="control-group">
        <label for="career" class="control-label">Ngành nghề<i>*</i></label>
        <ul>
            <li>
                <a rel="typePopup[ajax]" href="/company/type">
                    <div class="controls">
                        <input type=text name=career id=career class="input-xxlarge" value="<?php echo set_value('career', $company['career']); ?>">
                    </div>
                </a>
            </li>
        </ul>
      </div>
      <div class="control-group">
        <label for="salary" class="control-label">Mức lương<i>*</i></label>
        <div class="controls">
          <input type=text name=salary id=salary class="input-xxlarge" value="<?php echo set_value('salary', $company['salary']); ?>">
        </div>
      </div>
      <div class="control-group">
        <label for="position" class="control-label">Chức vụ<i>*</i></label>
        <div class="controls">
          <input type=text name=position id=position class="input-xxlarge" value="<?php echo set_value('position', $company['position']); ?>">
        </div>
      </div>
      <div class="control-group">
        <label for="level" class="control-label">Trình độ<i>*</i></label>
        <div class="controls">
          <input type=text name=level id=level class="input-xxlarge" value="<?php echo set_value('level', $company['level']); ?>">
        </div>
      </div>
      <div class="control-group">
        <label for="experience" class="control-label">Kinh nghiệm<i>*</i></label>
        <div class="controls">
          <input type=text name=experience id=experience class="input-xxlarge" value="<?php echo set_value('experience', $company['experience']); ?>">
        </div>
      </div>
      <div class="control-group">
        <label for="description" class="control-label">Mô tả công việc<i>*</i></label>
        <div class="controls">
    	  <textarea rows=3 cols=8 name="description"><?php echo set_value('description', $company['description']); ?></textarea>		             	
    	</div>
      </div>
      <div class="control-group">
        <label for="require" class="control-label">Yêu cầu<i>*</i></label>
        <div class="controls">
          <textarea rows=3 cols=8 name="require"><?php echo set_value('require', $company['require']); ?></textarea>
        </div>
      </div>
      <div class="control-group">
        <label for="benefit" class="control-label">Quyền lợi được hưởng<i>*</i></label>
        <div class="controls">
          <textarea rows=3 cols=8 name="benefit"><?php echo set_value('benefit', $company['benefit']); ?></textarea>
        </div>
      </div>
      <div class="control-group">
        <label for="record" class="control-label">Hồ sơ dự tuyển<i>*</i></label>
        <div class="controls">
          <textarea rows=3 cols=8 name="record"><?php echo set_value('record', $company['record']); ?></textarea>
        </div>
      </div>
      <div class="control-group">
        <div class=controls>
          <input type=hidden name=company_id id=company_id value="<?php echo $company['company_id'] ?>"/>
          <button class="btn" type=submit name=recruit value="Lưu thay đổi">Lưu thay đổi</button>
          <button class="btn" type="button">Hủy bỏ</button>
        </div>
      </div>
    </div>
  </form>
  
  <form method="post" class="form-horizontal" action=<?php echo base_url('company/add'); ?>>
    <script src="<?php echo base_url('theme/js/frontend/google.map.js'); ?>" type="text/javascript"></script>
	<script type="text/javascript">
    $(document).ready(function(){
      function OnLoad() {
        // Initialize the map with default UI.
        gMap = new google.maps.Map(document.getElementById("map"), {
          center: new google.maps.LatLng(21.0327, 105.8489),	// Ha Noi
          zoom: 13,
          mapTypeId: 'roadmap'
        });
      
        // Initialize the local searcher
        gLocalSearch = new GlocalSearch();
        gLocalSearch.setSearchCompleteCallback(null, OnLocalSearch);

        var edit = "<?php echo $company['lat']; ?>";
        if (edit) {
  		  // Khởi tạo marker khi edit
          marker = new google.maps.Marker({
            position: new google.maps.LatLng(document.getElementById('lat').value, document.getElementById('lng').value),
            map: gMap,
        	  draggable: true
          });
          
          google.maps.event.addListener(marker, 'dragend', function() {
        	  document.getElementById('lat').value = this.get('position').lat();
        	  document.getElementById('lng').value = this.get('position').lng();
          }); 

          gMap.setCenter(new google.maps.LatLng(document.getElementById('lat').value, document.getElementById('lng').value));
        }
      }

        GSearch.setOnLoadCallback(OnLoad);
      });
    </script>
    <h5>Vị trí người đăng tin</h5>
    <hr class="hr hr2" />
    
    <div class=map>
      <div class="control-group">
        <label for="record" class="control-label">Bản đồ google</label>
        <div class="controls">
		  <input type="text" id="queryInput" value="" style="width: 434px;" />
          <input type="button" class="btn btn-primary" value="Go!" onclick="doSearch()"/>
       	</div>
      </div>
      <div class="control-group">
        <div class="controls">
		  <div id="map" style="height: 350px; width: 500px; border: 1px solid #979797;"></div>
       	</div>
      </div>
      <div class="control-group">
        <div class=controls>
		  <input type="hidden" name=lat id="lat" value="<?php echo set_value('lat', $company['lat']); ?>"/>
		  <input type="hidden" name=lng id="lng" value="<?php echo set_value('lng', $company['lng']); ?>"/>
          <input type=hidden name=company_id id=company_id value="<?php echo $company['company_id'] ?>"/>
          <button class="btn" type="submit" name=map value="Lưu thay đổi">Lưu thay đổi</button>
          <button class="btn" type="button">Hủy bỏ</button>
        </div>
      </div>
    </div>
  </form>
  
  <script type="text/javascript">
    $(document).ready(function() {
      // validate form on keyup and submit
      $("#form-info").validate({
    	ignore: "",
    	rules: {
    	  name: {
    		required: true
    	  },
    	  address: {
      		required: true
      	  },
    	  email: {
    		required: true,
    		email: true
    	  },
      	  businesses: {
      		required: true
      	  },
      	  posting_area: {
      		required: true
      	  }
    	},
    	messages: {
    	  name: {
    		required: 'Tên công ty là yêu cầu'
    	  },
    	  address: {
      		required: 'Địa chỉ là yêu cầu'
      	  },    	  
    	  email: {
    		required: 'Email là yêu cầu',
    		email: 'Địa chỉ email không hợp lệ'
    	  },
    	  businesses: {
      		required: 'Lĩnh vực kinh doanh là yêu cầu'
      	  }, 
      	  posting_area: {
          	required: 'Khu vực đăng tin là yêu cầu'
          }
    	},
  	    submitHandler: function(form) {
  	      $pnk('company_background').value = $pnk('epic_iframe').contentWindow.document.body.innerHTML;
  		  form.submit();
  		}
      }); // end validate

      // validate form on keyup and submit
  	  $("#form-recruit").validate({
    	rules: {
  		  date: {
    		required: true
    	  },
    	  quantity: {
      		required: true
      	  },
      	  property: {
        	required: true
          },
          work_place: {
          	required: true
          },
          career: {
           	required: true
          },
          salary: {
            required: true
          },
          position: {
            required: true
          },
          level: {
            required: true
          },
          experience: {
            required: true
          },
          description: {
            required: true
          },
          require: {
            required: true
          },
          benefit: {
            required: true
          },
          record: {
            required: true
          }
    	},
    	messages: {
    	  name: {
    		required: 'Ngày đăng tuyển dụng là yêu cầu'
    	  },
    	  quantity: {
      		required: 'Số lượng cần tuyển là yêu cầu'
      	  },
      	  property: {
        	required: 'Tính chất là yêu cầu'
          },
          work_place: {
          	required: 'Địa điểm làm việc là yêu cầu'
          },
          career: {
           	required: 'Ngành nghề là yêu cầu'
          },
          salary: {
            required: 'Mức lương là yêu cầu'
          },
          position: {
            required: 'Chức vụ là yêu cầu'
          },
          level: {
            required: 'Trình độ là yêu cầu'
          },
          experience: {
            required: 'Kinh ngiệm là yêu cầu'
          },
          description: {
            required: 'Mô tả công việc là yêu cầu'
          },
          require: {
            required: 'Yêu cầu là yêu cầu'
          },
          benefit: {
            required: 'Quyền lợi được hưởng là yêu cầu'
          },
          record: {
            required: 'Hồ sơ dự tuyển là yêu cầu'
          }	  
    	}
      });  // end validate
    });
  </script>  
</div>